package gdi1.electricbox.gui;

import java.awt.event.KeyEvent;
import java.util.List;

import javax.swing.ImageIcon;
import javax.swing.JPanel;

import gdi1.electricbox.controller.Controller;
import gdi1.electricbox.game.data.elements.Battery;
import gdi1.electricbox.game.data.elements.FanLeft;
import gdi1.electricbox.game.data.elements.FanRight;
import gdi1.electricbox.game.data.elements.GameElement;
import gdi1.electricbox.game.data.elements.HamsterWheel;
import gdi1.electricbox.game.data.elements.Heat;
import gdi1.electricbox.game.data.elements.LaserBeam;
import gdi1.electricbox.game.data.elements.LightBulb;
import gdi1.electricbox.game.data.elements.MirrorLeftMinus90;
import gdi1.electricbox.game.data.elements.MirrorLeftPlus90;
import gdi1.electricbox.game.data.elements.MirrorMinus90;
import gdi1.electricbox.game.data.elements.MirrorPlus90;
import gdi1.electricbox.game.data.elements.PowerSink;
import gdi1.electricbox.game.data.elements.PowerSource;
import gdi1.electricbox.game.data.elements.SteamDetector;
import gdi1.electricbox.game.data.elements.WaterBoiler;
import gdi1.electricbox.game.data.elements.WireHorizontal;
import gdi1.electricbox.game.data.elements.WireVertical;
import gdi1.electricbox.utils.IconLoader;
import gdi1.electricbox.utils.OverlayIcon;
import de.tu_darmstadt.gdi1.framework.interfaces.IUserInterfaceEvent;
import de.tu_darmstadt.gdi1.framework.utils.Dictionary;
import de.tu_darmstadt.gdi1.framework.utils.FrameworkUtils;
import de.tu_darmstadt.gdi1.framework.utils.Point;
import de.tu_darmstadt.gdi1.framework.view.UserInterface;

public class GUI extends UserInterface<GameElement> {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private Controller _controller;

	private final static String MENU_PATH = "resource/menu/menu.xml";

	public GUI(Controller controller) {
		super(true, MENU_PATH, new JPanel(), null);
		_controller = controller;
		// TODO Auto-generated constructor stub
	}

	@Override
	protected void handleNonFrameworkEvents(
			IUserInterfaceEvent<GameElement> event) {
		// TODO Auto-generated method stub

	}

	@Override
	protected void mouseClicked(int x, int y) {
		// TODO Auto-generated method stub

	}

	@Override
	protected void keyboardKeyTyped(KeyEvent evt) {
		// TODO Auto-generated method stub

	}

	@Override
	protected void keyboardKeyPressed(KeyEvent e) {
		// TODO Auto-generated method stub

	}

	@Override
	protected void keyboardKeyReleased(KeyEvent e) {
		// TODO Auto-generated method stub

	}

	@Override
	public void menuItemClicked(String itemName) {
		// TODO Auto-generated method stub

	}

	@Override
	protected void closingRequested() {
		// TODO Auto-generated method stub

	}

	@Override
	public ImageIcon getComponentForList(List<GameElement> aList,
			Point coordinates) {

		if (aList == null) {
			System.err.println("GUI.getComponentForList: param aList = null!"); // TODO
																				// sinnvoller
																				// gestalten
		} else {

			ImageIcon icon;
			
			//zum Test erstmal nur 4 icons
			for (GameElement element : aList) {
				if (element instanceof Battery) {
					icon = IconLoader.getIcon(IconLoader.BATTERY);
				} else if (element instanceof FanLeft) {
					icon = IconLoader.getIcon(IconLoader.FAN_LEFT);
				} else if (element instanceof FanRight) {
					icon = IconLoader.getIcon(IconLoader.FAN_RIGHT);
				} else if (element instanceof HamsterWheel) {
					icon = IconLoader.getIcon(IconLoader.HAMSTER_WHEEL);
				}
//				} else if (element instanceof Heat) {
//
//				} else if (element instanceof LaserBeam) {
//
//				} else if (element instanceof LightBulb) {
//
//				} else if (element instanceof MirrorLeftMinus90) {
//
//				} else if (element instanceof MirrorLeftPlus90) {
//
//				} else if (element instanceof MirrorMinus90) {
//
//				} else if (element instanceof MirrorPlus90) {
//
//				} else if (element instanceof PowerSink) {
//
//				} else if (element instanceof PowerSource) {
//
//				} else if (element instanceof SteamDetector) {
//
//				} else if (element instanceof WaterBoiler) {
//
//				} else if (element instanceof WireHorizontal) {
//
//				} else if (element instanceof WireVertical) {
//
//				}
			}
			
		}

		return null;
	}
}
